<div class="container">
	<ol class="breadcrumb">
		<li><?php echo anchor('', 'Início'); ?></li>
		<li><?php echo anchor('parasuaempresa', 'Para Sua Empresa'); ?></li>
		<li class="active">Dados de atendimento</li>
	</ol>
</div>

<div class="container">
	<div class="row">
		<?php $this->load->view('parasuaempresa/_sidebar'); ?>

		<div class="col-md-9 col-md-9">
			<h3 class="titulos">Taxa entrega</h3>

			<?php
			if(!empty($formMessage) && $form_origem == 'taxa_entrega'){
				$cssOptions = array('alert-danger', 'alert-warning', 'alert-success');
				$cssAlert = $cssOptions[$formMessage[0]-1];
				?>
				<div class="alert <?php echo $cssAlert; ?>">
					<?php echo $formMessage[1]; ?>
				</div>
				<?php
			}
			?>

			<?php 
				$hidden     = array('datetime' => date('Ymdhmi'), 'form_origem'=>'taxa_entrega');
				$attributes = array("role"=>"form", "id"=>"taxa_entrega");
				echo form_open('parasuaempresa/dados_atendimento', $attributes, $hidden); 
			?>

			<div class="row">
				<div class="col-sm-3 form-group">
					<label for="taxa_entrega">Taxa de entrega</label>
					<?php echo form_input(array('name'=>'taxa_entrega','id'=>'taxa_entrega','class'=>'form-control', 'value'=>$empresa->getTaxaEntrega())); ?>
				</div>
			</div>	

			<input type="submit" class="btn btn-primary pull-right" value="Atualizar" />

			<div class="clearfix"></div>

			<?php
				echo form_close();
			?>

			<h3 class="titulos">Formas de pagamento aceitas</h3>

			<?php
			if(!empty($formMessage) && $form_origem == 'formas_pagto'){
				$cssOptions = array('alert-danger', 'alert-warning', 'alert-success');
				$cssAlert = $cssOptions[$formMessage[0]-1];
				?>
				<div class="alert <?php echo $cssAlert; ?>">
					<?php echo $formMessage[1]; ?>
				</div>
				<?php
			}
			?>

			<?php 
				$hidden     = array('datetime' => date('Ymdhmi'), 'form_origem'=>'formas_pagto');
				$attributes = array("role"=>"form", "id"=>"formas_pagto");
				echo form_open('parasuaempresa/dados_atendimento', $attributes, $hidden); 
			?>

			<?php
				$checked_formas  = array();
				$formas_marcadas = $empresa->getFormasPagto();

				foreach($formas_marcadas as $forma_marcada){
					array_push($checked_formas, $forma_marcada->getCodFormaAuto());
				}

				foreach($formas_pagto as $forma_pagto){
					$checked = in_array($forma_pagto->cod_forma_auto, $checked_formas);
			?>
			<label class="checkbox-inline">
				<input type="checkbox" id="forma_pagto_<?php echo $forma_pagto->cod_forma_auto; ?>" <?php if($checked){ ?>checked="checked"<?php } ?> name="formas_pagto[]" value="<?php echo $forma_pagto->cod_forma_auto; ?>"> <?php echo $forma_pagto->desc_forma_pagto; ?>
			</label>
			<?php
				}
			?>

			<div class="clearfix"></div>

			<input type="submit" class="btn btn-primary pull-right" value="Atualizar" />

			<div class="clearfix"></div>

			<?php
				echo form_close();
			?>

		</div>
	</div>
</div>